const app = getApp()
var config = require('../../../config.js');
const util = require('../../../utils/util.js');
var xrRequest = require('../../../vendor/hope-sdk/core/request.js');
var WxParse = require('../../../vendor/wxParse/wxParse.js');
Page({
  data: {
    info:null,
    article:""
  },
  onLoad: function (options) {
    this.init();
  },
  init:function(){
    var that = this;
    xrRequest.request(app, {
      url: config.service.articleInfo,
      login: false,
      data: {
        id: 1
      },
      success: function (res) {
        if (res.data.code == 1) {
          that.setData({
            info: res.data.data
          });
          that.bind();
        } else {
          wx.showToast({
            title: res.data.msg,
            icon: 'none',
          })
        }
      },
      fail: function (res) {
        wx.showToast({
          title: res,
          icon: 'none',
        })
      }
    })
  },
  bind:function(){
    var that = this;
    var content = that.data.info.content;
    var temp = WxParse.wxParse('article', 'html', content, that, 5);
    that.setData({
      article: temp
    })
  }
})